# -*- coding: UTF-8 -*- 
'''
Created on 04/04/2013

@author: rubenbarroso
'''

#Funcion map
def cuadrado(n):
    return n ** 2
l = [1, 2, 3]
l2 = map(cuadrado, l)

print l2

#Funcion filter
def es_par(n):
    return (n % 2.0 == 0)
l = [1, 2, 3]
l2 = filter(es_par, l)

print l2

#Funcion reduce
def sumar(x, y):
    return x + y

l = [1, 2, 3]
l2 = reduce(sumar, l)

print l2

#funciones lambda
l = [1, 2, 3]
l2 = filter(lambda n: n % 2.0 == 0, l)

print l2

#PENDIENTE: decoradores, generadores, compresion de listas.
